/**
 * The Prophecy
 * java based lightweight texas hold'em poker software base
 * http://code.google.com/p/theprophecy/
 */

package org.poker.prophecy.math;

/**
 * Mies implementiert aber funktioniert sauber :-)
 * @author bg
 */

public class Chance {

    public static int gimmeRandomNumberBetween0andX(int x){
        String string = new Integer(x).toString(); 
        int stellen = string.length();
        String returnString = new String();
        
        while(true){
            for (int i = 0; i < stellen; i++) {
                returnString += Integer.parseInt(new Character(new Double(Math.random()).toString().charAt(3)).toString());
            }
            if (Integer.parseInt(returnString) <= x){
                return Integer.parseInt(returnString);
            }
            else{
                returnString = new String();
            }
        }
    }
   
    public static boolean randomYesOrNo(){
    	switch(gimmeRandomNumberBetween0andX(1)){
    		case 0: return false;
    		default: return true;
    	}
    }
    
    public static void main(String[] args) {
        for (int i = 0; i < 100; i++) {
            System.out.println(gimmeRandomNumberBetween0andX(100));
        }
    }

}
